<template>
  <div>
     <h1>子组件</h1>
     <h1>接受父组件的数据：{{msg}}</h1>
     <button @click="tochange">改变父组件的数据</button>
     
     <input type="text" :value="name"
     @input="$emit('update:name',$event.target.value)">
  </div>
</template>
<script setup>
import {defineProps} from 'vue'
const props = defineProps({
  msg: String,
  name:String
})
let emit=defineEmits(["update:msg"])
let tochange=()=>{
   emit("update:msg","我是子组件传来的数据")
}

</script>